#pragma once
#ifndef __MUTEX_H__
#define __MUTEX_H__
#include <mutex>

namespace MutexModule
{
    class Mutex
    {
    public:
        Mutex() = default;
        void lock()
        {
            mutex.lock();
        }
        void unlock()
        {
            mutex.unlock();
        }
        std::mutex* Get()
        {
            return &mutex;
        }
        ~Mutex() = default;
    private:
        std::mutex mutex;
    };

    class MutexProtect
    {
    public:
        MutexProtect(Mutex* _mutex) :mutex(_mutex)
        {
            mutex->lock();
        }
        ~MutexProtect()
        {
            mutex->unlock();
        }
    private:
        Mutex* mutex;
    };
}
#endif